import 'dart:io';

void main(List<String> args) {
  // 1. 约定类型
  List<int> list = [1, 2, 3, 4, 5];
  print(list);
  List<String> cate = ['服饰', '电脑'];
  print(cate);

  Map<String, String> goods = {'name': '电脑', 'price': '100.0'};
  print(goods);

  // 函数泛型
  getData<String>('Tom');
  getData<double>(100.0);

  // Future的泛型
  login().then((result) {
    print(result);
  });
}

T getData<T>(T parmas) {
  return parmas;
}

Future<String> login() {
  return Future<String>(() {
    sleep(Duration(seconds: 3));
    return 'token-10086';
  });
}
